//
//  LKHomeCycleImagesViewModel.m
//  YLHelper
//
//  Created by she1323 on 2018/5/25.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKHomeCycleImagesViewModel.h"
#import "LKHomeCycleImagesModel.h"


@implementation LKHomeCycleImagesViewModel

-(RACCommand *)requesrCommand{
    if (!_requesrCommand) {
        WS(weakSelf)
        _requesrCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id  _Nullable input) {
            return [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
                NSLog(@"%@",[LKUserInforTool header]);
                [[LKNetDataManager defaultManager] sendRequestMethod:HTTPMethodPOST serverUrl:ServerlUrl apiPath:homeCyleImagesUrl header:[LKUserInforTool header] parameters:nil progress:^(NSProgress * _Nullable progress) {
                    
                } success:^(BOOL isSuccess, id  _Nullable responseObject) {
                    LKHomeCycleImagesItem *item = [LKHomeCycleImagesItem modelWithDictionary:responseObject];
                    weakSelf.imgaesArray = item.result;
                    
                    [subscriber sendNext:nil];
                    [subscriber sendCompleted];
                } failure:^(NSString * _Nullable errorMessage) {
                    [subscriber sendCompleted];
                }];
                return nil;
            }];
        }];
    }
    return _requesrCommand;
}

@end
